﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraWaitForm;

namespace Comteck.Winforms {
  /// <summary>
  /// 等待界面
  /// </summary>
  public partial class FrmWaitForm : WaitForm {
    public FrmWaitForm() {
      InitializeComponent();
      this.progressPanel1.AutoHeight = true;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="caption"></param>
    public override void SetCaption(string caption) {
      base.SetCaption(caption);
      this.progressPanel1.Caption = caption;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="description"></param>
    public override void SetDescription(string description) {
      base.SetDescription(description);
      this.progressPanel1.Description = description;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="cmd"></param>
    /// <param name="arg"></param>
    public override void ProcessCommand(Enum cmd, object arg) {
      base.ProcessCommand(cmd, arg);

      var command = (LoadWaitFormCommand) cmd;

      switch (command) {
        case LoadWaitFormCommand.ChangeTitle:
          // 改变标题
          this.SetCaption(arg as string);
          break;
        case LoadWaitFormCommand.ChangeDesc:
          // 进度条
          this.SetDescription(arg as string);
          break;
        default:
          break;
      }

    }

  }

  /// <summary>
  /// 记载提示信息命令
  /// </summary>
  public enum LoadWaitFormCommand {
    /// <summary>
    /// 改变标题
    /// </summary>
    ChangeTitle,

    /// <summary>
    /// 改变描述
    /// </summary>
    ChangeDesc,
  }

}